/**
 * 
 */
package com.wjk.restful.controller;

import java.util.concurrent.atomic.AtomicInteger;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.wjk.restful.bean.Greeting;

/**
 *
 * <br>
 *
 * @author wanjk@c-platform.com
 *
 *         <p>
 * @date 创建时间：2018年4月8日:下午11:20:05
 *       </p>
 *
 * 
 */
@RestController
@EnableAutoConfiguration
public class HelloCoontroller {

	private static final String temple = "hello,%s!";

	private static AtomicInteger counter = new AtomicInteger();

	@RequestMapping("/greeting")
	public Greeting greeting(@RequestParam(value = "name", defaultValue = "world") String name) {

		return new Greeting(counter.incrementAndGet(), 
				String.format(temple,name));
	}
	public static void main(String[] args) {
		SpringApplication.run(HelloCoontroller.class, args);
	}
}
